﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>报名明细</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <link href="https://cdn.bootcss.com/amazeui/2.7.2/css/amazeui.css" rel="stylesheet">
    <link href="css/common.css" rel="stylesheet" />
    <style>
        .veads1_i1 {
            display: block;
            float: left;
            margin-top: 2%;
            width: 2.5%;
        }

        .veads1_s1 {
            display: block;
            text-align: center;
            font-size: 1.8rem;
        }

        .main {
            width: 100%;
        }

        .main_d1 {
            width: 100%;
            padding: 3%;
            display: flex;
            flex: 1;
            justify-content: center;
            align-items: center;
        }

        .maind1_d1 {
        }

        .maind1_img02 {
            width: 14%;
        }

        .maind1_sp1 {
            font-size: 1.5rem;
        }

        .maind1_img01 {
            width: 60%;
            display: block;
            float: left;
        }

        .maind1_d2 {
            width: 10%;
            display: block;
            flex: 0.1;
            float: left;
            justify-content: center;
            align-items: center;
        }

        .main_d2 {
            display: flex;
            flex: 1;
            float: left;
            flex-direction: column;
        }

        .maind1_sp2 {
            display: flex;
            flex: 0.1;
            float: right;
            font-size: 2.4rem;
        }

        .maind1_cont01, .maind1_cont02 {
            display: flex;
            flex: 1;
            justify-content: space-between;
            color: #5d5d5d;
        }

        .line {
            width: 100%;
            border: 2px solid #efefef;
        }

        .orde_01 {
            width: 100%;
            overflow: hidden;
            padding: 5% 5%;
        }

        .orde1_s1 {
            color: #505050;
            font-size: 1.5rem;
            display: block;
            margin-right: 5%;
            float: left;
        }

        .orde1_s2 {
            font-size: 1.5rem;
            font-weight: 500;
            display: block;
            float: left;
            color: #101010;
        }

        .orde1_s3 {
            color: #ff9129;
            font-size: 1.5rem;
        }

        .orde_02 {
            background: #efefef;
            width: 100%;
            padding: 1% 0;
        }

        .orde_03 {
            overflow: hidden;
            padding: 3% 3%;
            margin-bottom: 6.5rem;
        }

        .orde_zidingyi {
            position: fixed;
            bottom: 0;
            width: 100%;
        }

        .orde3_i1 {
            width: 6%;
            display: block;
            float: left;
            margin-right: 2%;
            margin-top: 2%;
        }

        .orde3_s1 {
            font-size: 1.8rem;
        }

        .orde3_d1 {
            overflow: hidden;
            margin-bottom: -2%;
        }

        .price_fixed {
            background: #3d3d3d;
            padding: 2%;
            position: fixed;
            bottom: 0;
            width: 100%;
        }

        .price_money01 {
            color: #fff;
            font-size: 2.4rem;
        }

        .price_money02 {
            color: #fff;
            font-size: 1.4rem;
        }

        .price_end {
            position: absolute;
            height: 100%;
            width: 30%;
            text-align: center;
            color: #fff;
            background: #23c788;
            top: 0;
            right: 0;
        }

        .discount_01 {
            padding: 3%;
            text-align: center;
            border-bottom: 1px solid #ececec;
        }

        .discount_02 {
            padding: 2% 3%;
        }

        .discount2_d1 {
            background-repeat: no-repeat;
            background-size: cover;
            width: 100%;
            padding: 1% 3%;
        }

        .discount2_sp1 {
            text-decoration: line-through;
            color: #a0a0a0;
            font-size: 1.4rem;
        }

        .discount2_sp2 {
            color: #000;
            font-size: 1.7rem;
        }

        .discount2_sp3 {
            display: block;
            text-align: left;
            font-size: 1.7rem;
            margin-bottom: 1%;
        }

        .discount2_sp4 {
            display: block;
            text-align: left;
            font-size: 1.3rem;
        }

        .discount2_d2 {
            float: right;
            margin-top: -12.5%;
        }
    </style>
</head>
<body>
    <div id="vult" v-cloak>

        <div class="page am-page">

            <header data-am-widget="header" class="am-header am-header-default" style="background-color: #FFFFFF; border-bottom: 1px solid rgb(211, 211, 211);">
                <div class="am-header-left am-header-nav" onclick="goBack()">
                    <a href="javascript:" class="">

                        <img class="am-header-icon-custom" src="images/veas07.png" alt="" />
                    </a>
                </div>

                <h4 class="am-header-title" style=" color: black; width: 100%; margin: 0 auto;">
                    {{actinfo.a.Name}}
                </h4>

                <div class="am-header-right am-header-nav"><a href="/Wap/Index.html" class="am-header-icon am-icon-home" style="color: #A9A9A9; "></a></div>
            </header>

            <div class="main">

                <div class="orde_01">
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0">
                            <span class="orde1_s1">报名种类</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2">{{item.Name}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0">
                            <span class="orde1_s1">最大报名数</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2">{{item.maxSign==0?"无上限":item.maxSign}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0">
                            <span class="orde1_s1">已报名人数</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2">{{item.numSign}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0%">
                            <span class="orde1_s1">报名费</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s3">{{item.Price}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0%">
                            <span class="orde1_s1">订单状态</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s3">{{signinfo.State==0?"未付款":signinfo.State==1?"已付款":signinfo.State==-1?"已取消":"状态异常"}}</span>
                        </div>
                    </div>
                </div>
                <div class="orde_02"></div>
                <div class="orde_03" style="margin-bottom: 0rem;">
                    <div class="orde3_d1">
                        <img src="images/orde01.png" alt="" class="orde3_i1"><span class="orde3_s1">优惠信息</span>
                    </div>
                    <ul class="am-list" v-if="signinfo.State==0  && torder.discountGId ==''">
                        <li data-am-modal="{target: '#my-actions'}" style="overflow: hidden;padding: 3% 0;" v-on:click="xuanze">
                            <span style="float:left;">优惠券</span>
                            <span class="am-icon am-icon-angle-right" style="display: block;float: right"></span>
                            <span style="float:right;margin-right: 2%;">{{useDiscount==""?"暂无":"优惠" + dismoney + "元"}}</span>
                        </li>
                    </ul>
                    <ul class="am-list" v-else-if="signinfo.State==0  && torder.discountGId =='-1'">
                        <li style="overflow: hidden;padding: 3% 0;">
                            <span style="float:left;">优惠券</span>
                            <span class="am-icon am-icon-angle-right" style="display: block;float: right"></span>
                            <span style="float:right;margin-right: 2%;">暂无优惠</span>
                        </li>
                    </ul>
                    <ul class="am-list" v-else-if="signinfo.State==0  && torder.discountGId !='-1'">
                        <li style="overflow: hidden;padding: 3% 0;">
                            <span style="float:left;">优惠券</span>
                            <span class="am-icon am-icon-angle-right" style="display: block;float: right"></span>
                            <span style="float:right;margin-right: 2%;">{{torder.Discount<=0?"未使用优惠":"已优惠" + torder.Discount + "元"}}</span>
                        </li>
                    </ul>
                    <ul class="am-list" v-if="signinfo.State==1">
                        <li style="overflow: hidden;padding: 3% 0;">
                            <span style="float:left;">优惠券</span>
                            <span style="float:right;margin-right: 2%;">{{torder.Discount<=0?"未使用优惠":"已优惠" + torder.Discount + "元"}}</span>
                        </li>
                    </ul>
                </div>
                <div class="line"></div>
                <div class="orde_01">
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0">
                            <span class="orde1_s1">联系电话</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2">{{actinfo.a.Phone}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0">
                            <span class="orde1_s1">地址</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2" v-on:click="toMap()">{{actinfo.a.Adress}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0%">
                            <span class="orde1_s1">活动开始时间</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2">{{info.startTime}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0%">
                            <span class="orde1_s1">活动结束时间</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2">{{info.endTime}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0%">
                            <span class="orde1_s1">报名开始时间</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2">{{info.startSignTime}}</span>
                        </div>
                    </div>
                    <div class="am-g" style="margin-bottom: 3%">
                        <div class="am-u-sm-3" style="padding: 0%">
                            <span class="orde1_s1">报名结束时间</span>
                        </div>
                        <div class="am-u-sm-9" style="padding: 0">
                            <span class="orde1_s2">{{info.endSignTime}}</span>
                        </div>
                    </div>
                </div>
                <div class="line"></div>
                <div class="am-form">

                    <fieldset>
                        <div v-for="item in actinfo.form.item" class="formclass">
                            <div class="am-form-group field1" v-if="item.itemtype=='text'" v-bind:type="item.itemtype">
                                <label for="doc-ipt-name-1">{{item.i.Name}}:</label>
                                <div v-for="subitem in actinfo.subuser.subuserdata" v-if="item.option[0].gId==subitem.OptiongId">
                                    {{subitem.Content}}
                                </div>
                            </div>

                            <div class="am-form-group field1" v-else-if="item.itemtype=='radio'" v-bind:type="item.itemtype">
                                <label for="doc-ipt-name-1">{{item.i.Name}}:</label>
                                <div v-for="subitem in actinfo.subuser.subuserdata">
                                    <label class="am-radio" v-for="option in item.option" v-if="option.gId==subitem.OptiongId">
                                        <input type="radio" v-bind:value="option.gId" v-bind:name="item.i.gId" checked disabled>{{option.Name}}
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group field1" v-else-if="item.itemtype=='checkbox'" v-bind:type="item.itemtype">
                                <label for="doc-ipt-name-1">{{item.i.Name}}:</label>
                                <div v-for="subitem in actinfo.subuser.subuserdata">
                                    <label class="am-checkbox" v-for="option in item.option" v-if="option.gId==subitem.OptiongId">
                                        <input type="checkbox" v-bind:value="option.gId" v-bind:name="item.i.gId" checked disabled> {{option.Name}}
                                    </label>
                                </div>
                            </div>
                        </div>
                    </fieldset>
                </div>

                <div class="line"></div>
                <div class="acdetamain_05" style="margin-bottom:80px;">
                    <span style="display: block;margin: 3% 0">培训介绍</span>
                    <article class="am-article">
                        <div class="am-article-bd" v-html="actinfo.a.Info"></div>
                    </article>

                </div>
            </div>
            <!--<div class="orde_zidingyi" v-if="signinfo.State==0?true:false">
                <button type="button" class="am-btn am-btn-default" v-on:click="Pay()" style="width: 100%; border: none;background: #23c788;color: #fff;height: 5.5rem;">确定支付</button>
            </div>-->

            <div class="price_fixed" v-if="signinfo.State==0">
                <span class="price_money01">￥{{money}}  | </span>
                <span class="price_money02">已优惠￥{{dismoney}}</span>
                <button class="am-btn price_end" v-on:click="useDiscountpay()">确认支付</button>
            </div>
        </div>

        <div class="am-modal-actions" id="my-actions" style="background: #fff;height: 65%;">
            <div class="discount_01">
                <span>选择优惠方式</span><img src="images/veas08.png" alt="" class="closewindows" data-am-modal-close style="float: right" v-on:click="closewindows()">
            </div>
            <div class="discount_02" v-on:click="useCard('',-1,'')">
                <div class="discount2_d1" style="background-image: url(images/discount_03.png); ">
                    <span class="discount2_sp3">不使用优惠</span>
                    <span class="discount2_sp4">
                        本次不使用
                    </span>
                    <div class="discount2_d2">
                        <span class="discount2_sp1">￥{{yuanmoney}}</span>
                        <span class="discount2_sp2">￥{{yuanmoney}} </span>
                        <img v-bind:src="''==useDiscount? 'images/discount_02.png': 'images/discount_01.png'" alt="" style="width: 20%;">
                    </div>
                </div>
            </div>
            <!--{{list.discountGId}}{{useDiscount}}-->
            <div class="discount_02" v-on:click="useCard(list.o.gId,list.o.HdType,list.o.HdValue)" v-for="(list,index) in discount">
                <div class="discount2_d1" style="background-image: url(images/discount_03.png); ">
                    <span class="discount2_sp3">{{list.o.Name}}</span>
                    <span class="discount2_sp4">可享{{list.o.HdType==1?list.o.HdValue + "元":list.o.HdValue +"%"}}优惠，每月可用{{list.o.Hdnumber}}次<span style="color: #f6a279;">（剩余{{list.o.Hdnumber-list.count}}次）</span></span>
                    <div class="discount2_d2">
                        <span class="discount2_sp1">￥{{money}}</span>
                        <span class="discount2_sp2">￥{{list.dismoney}} </span>
                        <img v-bind:src="list.o.gId==useDiscount? 'images/discount_02.png': 'images/discount_01.png'" alt="" style="width: 20%;">
                    </div>
                </div>
            </div>

        </div>
    </div>
</body>
<script src="https://use.fontawesome.com/ca6b609d64.js"></script>
<script src="https://cdn.bootcss.com/jquery/1.8.3/jquery.js"></script>
<script src="js/common.js"></script>
<script src="https://cdn.bootcss.com/vue/2.5.9/vue.js"></script>
<script src="https://cdn.bootcss.com/amazeui/2.7.2/js/amazeui.js"></script>
<script>

</script>
</html>

<script>

    var page = new Vue({
        el: '#vult',
        data: {
            signid: 0,
            signinfo: {},
            torder: {},//T_ORDER数据
            actinfo: { a: {}, form: {}, subuser: {} },
            item: {},
            info: {},
            isshow: false,//是否显示优惠券/卡弹框
            discount: [],//优惠券/卡数组
            useDiscount: "",//使用的优惠券/卡Gid
            money: 0,
            dismoney: 0,
            distype: 0,
            yuanmoney: 0,
        },
        methods: {
            getInfo: function () {
                var that = this;
                $.ajax({
                    type: 'POST',
                    url: apiUrl + '/Api/Mine/MyActivityInfo',
                    data: { "gId": that.signid },
                    success: function (data) {
                        console.log(data);
                        if (data.errcode == 0) {
                            that.info = data.data.MyActivityInfo;
                            that.signinfo = that.info.o;
                            that.torder = that.info.order;
                            that.actinfo = that.info.activity;
                            that.item = that.info.actitem;
                            that.money = that.signinfo.Money;
                            that.yuanmoney = that.signinfo.Money;
                            if (that.signinfo.State == 0 && that.torder.discountGId != '') {
                                that.money = that.money - that.torder.Discount;
                                that.dismoney = that.torder.Discount;
                            }
                        } else {
                            alert(data.errmsg);
                        }
                    },
                })
            },
            toMap: function () {
                location.href = 'map.html?xPoint=' + this.actinfo.a.xPoint + "&yPoint=" + this.actinfo.a.yPoint;
            },
            useCard: function (discountGId, disType, disvalue) {
                var that = this;
                that.useDiscount = discountGId;
                if (disType == 1) {
                    that.distype = 1;
                    that.money = Math.round((that.signinfo.Money - disvalue) * 100) / 100;//that.orderinfo.payMoney - disvalue;
                    that.dismoney = disvalue;
                }
                else if (disType == 2) {
                    that.distype = 2;
                    that.money = Math.round((that.signinfo.Money - that.signinfo.Money * disvalue / 100) * 100) / 100;// that.orderinfo.payMoney - that.orderinfo.payMoney * disvalue / 100;
                    that.dismoney = Math.round((that.signinfo.Money * disvalue / 100) * 100) / 100;// that.orderinfo.payMoney * disvalue / 100;
                }
                else if (disType == -1) {
                    that.distype = -1;
                    that.money = that.signinfo.Money;
                    that.dismoney = 0;
                }
                $('.closewindows').click();
            },
            xuanze: function () {
                var that = this;
                that.money = that.signinfo.Money;
                $.ajax({
                    type: 'POST',
                    url: apiUrl + '/Api/Mine/GetCard',
                    data: { "venueId": that.actinfo.a.organizeGId, "orderid": that.signid, type: 5 },
                    success: function (data) {
                        if (data.errcode == 0) {
                            that.discount = data.data;
                            console.log(data.data);
                        } else if (data.errcode == -1) {
                            alert(data.errmsg);
                        } else {
                            alert(data.errmsg);
                        }
                    },
                    //error: function () {
                    //    alert("服务器加载异常");
                    //}
                })
                this.isshow = true;
            },
            closewindows: function () {
                this.isshow = false;
            },
            useDiscountpay: function () {
                var that = this;
                $.ajax({
                    url: apiUrl + "/Api/Field/createDisAllOrder",
                    data: { "Id": that.signid, "useDiscountGid": that.useDiscount, type: 5 },
                    type: "POST",
                    success: function (data) {
                        if (data.errcode == 0) {
                            $.wxpay({
                                Id: data.data.Id,
                                type: data.data.type,
                                success: function (res) {
                                    if (res.errcode == 0) {
                                        alert("支付成功");
                                        location.replace(location.href);
                                    }
                                    else {
                                        alert(res.errmsg);
                                    }
                                },
                                error: function (res) {
                                    alert(res.errmsg);
                                }
                            })
                        } else {
                            alert(data.errmsg);
                        }

                    },
                })
            },
            Pay: function () {
                var that = this;
                $.ajax({
                    url: apiUrl + "/Api/Field/createSign",
                    data: { "SigngId": that.signid },
                    type: "POST",
                    success: function (data) {
                        if (data.errcode == 0) {

                            $.wxpay({
                                Id: data.Id,
                                type: data.type,
                                success: function (res) {
                                    if (res.errcode == 0) {
                                        alert("支付成功");
                                        location.replace(location.href);
                                    }
                                    else {
                                        alert(res.errmsg);
                                    }
                                },
                                error: function (res) {
                                    alert(res.errmsg);
                                }
                            })
                        } else {
                            alert(data.errmsg);
                        }

                    }
                })

            }
        }
    });

    $(function () {
        var signid = $.getParam("gId");
        page.signid = signid;
        page.getInfo();
    })
</script>
